package com.lbiuse.cwc.wechat.service;

import com.lbiuse.wx.util.MapUtil;

import java.util.Map;
import java.util.UUID;

/**
 * Created by libing on 2015/9/13.
 */
public class WechatService {
    public String handleMessage(String message, String appId) {
        try {
            Map<String, String> map = MapUtil.fromXml(message);
            String openId = map.get("FromUserName");
            map.put("AppID", appId);
            if (!map.containsKey("MsgId")) {
                String uuid = UUID.randomUUID().toString().replaceAll("-", "");
                map.put("MsgId", uuid);
            }
            //query.executeById("wx.receivemessage.insert", map);

            return process.dispatcher(map);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }
}
